package com.example.binke.mapper;

import com.example.binke.pojo.Order;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrderMapper {
    @Select("SELECT id,customerId,`date`,address,state,total FROM `order` WHERE id =#{id}")
    Order getOne(Integer id);


    @Select("SELECT * FROM `order`")
    List<Order> getAll();


    @Delete("DELETE FROM `order` WHERE id =#{id}")
    void delete(Integer id);

    @Insert("INSERT INTO `order`(id,customerId,`date`,address,state,total) VALUES(#{id}, #{customerId}, #{`date`},#{address},#{state},#{total})")
    void insert(Order order);


}
